package com.neusoft.di.entity.error;

/**
 * @author itning
 * @date 2019/4/29 18:11
 */
//@Component
public class GlobalErrorAttributes { //    extends DefaultErrorAttributes {
//    @Override
//    public Map<String, Object> getErrorAttributes(ServerRequest request, ErrorAttributeOptions options) {
//        Throwable error = getError(request);
//        if (error instanceof ResponseStatusException) {
//            ResponseStatusException responseStatusException = (ResponseStatusException) error;
//            Map<String, Object> errorAttributes = new LinkedHashMap<>();
//            errorAttributes.put("code", responseStatusException.getStatusCode());
//            errorAttributes.put("msg", responseStatusException.getMessage());
//            errorAttributes.put("data", "");
//            return errorAttributes;
//        } else {
//            Map<String, Object> errorAttributes = super.getErrorAttributes(request, options);
//            errorAttributes.put("code", errorAttributes.getOrDefault("status", 404));
//            errorAttributes.put("msg", error.getMessage());
//            errorAttributes.put("data", "");
//            return errorAttributes;
//        }
//    }
}

